<%@ page language="java" import="java.util.*, dtt.*" pageEncoding="ISO-8859-1"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<%
  ArrayList projectBeanList = (ArrayList) request.getAttribute("projectBeanList");
  ArrayList userBeanList = (ArrayList) request.getAttribute("userBeanList");
  ArrayList roleBeanList = (ArrayList) request.getAttribute("roleBeanList");
  ArrayList detailRoleList = (ArrayList) request.getAttribute("detailRoleList");
 
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>Manage Role</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	
	<link rel="stylesheet" type="text/css" href="styles.css">
	
  <script type="text/javascript">

  function validateForm(){
  // if(window.defectform.projectId.value == ''){
  // alert('Please enter a valid project number');
  // return false;	
  };
  //end function
  </script>
  </head>
  
  <body>
  <form id="adddefectform" action="servlet/FrontController" method="post">
 
  <br>
    <table valign="top" border="0" align="center" width="85%"  >
     <tr>
     <td>Project</td>
     <td>User</td>
     <td>Roles </td>
     </tr>
     
     <tr>

     <td>
     <select name="projectselectitem" size=12>
       <%   
        Iterator itr = projectBeanList.iterator();
        while(itr.hasNext()){
        ProjectBean project = (ProjectBean) itr.next();
       %>
     <option> <%= project.getProjectNbr() %>
     </option>
        <%
        } //end while
       %>
           </select>
           </td>
           
       <td>
       <select name="userselectitem" size=12>
       <%
   
        Iterator itruser = userBeanList.iterator();
        while(itruser.hasNext()){
        %>
     <option> <%= (String)itruser.next() %>
     </option>
		<%
        } //end while
       %>
           </select>
       
       </td>
       
       <td>
           <input type="text" name="newrole" value="">
      <select name="roleselectitem" onchange="changetotext()">
       <%   
        Iterator itrrole = roleBeanList.iterator();
        while(itrrole.hasNext()){
        %>
     <option ><%= (String)itrrole.next() %>
     </option>
		<%
        } //end while
       %>
           </select> 
    <script>
    function changetotext(){
    document.forms[0].newrole.value = document.forms[0].roleselectitem.value;
    };
    </script>
        </td>
 </tr>
     <tr>
 	 <td>
 	 Role List (Select to Delete): </td>
 	 <td>
 	 
 	      <select name="roleselected" size=12 >
       <%   
        Iterator itrdetailrole = detailRoleList.iterator();
        while(itrdetailrole.hasNext()){
        String detailrole = (String)itrdetailrole.next() +"===" +(String)itrdetailrole.next()+"==="+(String)itrdetailrole.next();
       %>
     <option> <%= detailrole %>
     </option>
        <%
        } //end while
       %>
           </select>
         
 	 </td>    
     </tr>
     
    </table>
  	 
  	 <br>
  	 <center>
  	 <table cellspacing="2" cellpadding="2">  
       <tr>
       <td><input type="Submit" name="DTT_ACTION" value="MANAGE_ROLE" ></td>
       <td width="20%"> </td>
      <td><input type="Submit" name="DTT_ACTION" value="DEL_ROLE"></td>
       
      
       </tr>
  	
  	 </table>
  	 </center>
  	  </form>
  </body>
</html>
	